import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:wallpaper/generated/l10n.dart';

class Empty extends StatelessWidget {
  final double width;
  final String? tips;
  final double? fontSize;

  const Empty({
    super.key,
    this.width = 75,
    this.fontSize,
    this.tips,
  });

  @override
  Widget build(BuildContext context) {
    // 关键：用 SizedBox.expand 让 Empty 撑满父容器的可用空间
    // 同时内部用 Center 保证内容居中，避免依赖外部 Flex 布局
    final theme = Theme.of(context).colorScheme;
    return SizedBox.expand(
      child: Center(
        child: Column(
          // 仅让“图标+文本”占自身所需高度，不拉伸
          mainAxisSize: MainAxisSize.min,
          children: [
            FaIcon(
              FontAwesomeIcons.java,
              size: width,
              color: theme.onSurface.withOpacity(0.4),
            ),
            const SizedBox(height: 8), // 增加间距，优化视觉
            Text(
              tips ?? S.of(context).a1,
              style: TextStyle(
                color: theme.onSurface.withOpacity(0.4),
                fontSize: fontSize ?? 11,
                fontWeight: FontWeight.bold,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
